#include <iostream>
#include <string>
#include <map>

using namespace std;

int main()
{
    map<string, size_t> word_count;
    string word;
    while (cin >> word) // 终止输入使用ctrl+D
        ++word_count[word];
    for (auto w : word_count)
        cout << w.first <<" occurs " << w.second << endl;

    return 0;
}

